class Collection < ActiveRecord::Base

  validates_presence_of :name, :museum_id
  validates_uniqueness_of :name, :scope => :museum_id
  has_many :entities
  

  def self.find_or_create(params)
    collection = Collection.find_by_name(params[:name])
    
    unless collection
      collection = Collection.new(params)
      collection.save
    end  
    
    return collection
  end

end
